home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ainet / newmv.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-20  |  5.7 KB  |  204 lines

  1. VERSION 4.00
  2. Begin VB.Form NewMV 
  3.    Caption         =   "New Model Vector ..."
  4.    ClientHeight    =   3492
  5.    ClientLeft      =   1560
  6.    ClientTop       =   2340
  7.    ClientWidth     =   4332
  8.    Height          =   3876
  9.    Left            =   1512
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3492
  12.    ScaleWidth      =   4332
  13.    Top             =   2004
  14.    Width           =   4428
  15.    Begin VB.CommandButton OkBtn 
  16.       Caption         =   "OK"
  17.       Default         =   -1  'True
  18.       Height          =   372
  19.       Left            =   3120
  20.       TabIndex        =   10
  21.       Top             =   840
  22.       Width           =   972
  23.    End
  24.    Begin VB.Frame Frame2 
  25.       Caption         =   "New Model Vector Data"
  26.       Height          =   852
  27.       Left            =   240
  28.       TabIndex        =   12
  29.       Top             =   1920
  30.       Width           =   3852
  31.       Begin VB.TextBox Hole 
  32.          Height          =   288
  33.          Left            =   3000
  34.          ReadOnly        =   -1  'True
  35.          TabIndex        =   14
  36.          Top             =   360
  37.          Width           =   612
  38.       End
  39.       Begin VB.TextBox YC 
  40.          Height          =   288
  41.          Left            =   1560
  42.          TabIndex        =   9
  43.          Top             =   360
  44.          Width           =   612
  45.       End
  46.       Begin VB.TextBox XC 
  47.          Height          =   288
  48.          Left            =   480
  49.          TabIndex        =   7
  50.          Top             =   360
  51.          Width           =   612
  52.       End
  53.       Begin VB.Label Label4 
  54.          Alignment       =   1  'Right Justify
  55.          Caption         =   "Is hole?"
  56.          Height          =   252
  57.          Left            =   2160
  58.          TabIndex        =   13
  59.          Top             =   360
  60.          Width           =   732
  61.       End
  62.       Begin VB.Label Label3 
  63.          Alignment       =   1  'Right Justify
  64.          Caption         =   "&Y:"
  65.          Height          =   252
  66.          Left            =   1200
  67.          TabIndex        =   8
  68.          Top             =   360
  69.          Width           =   252
  70.       End
  71.       Begin VB.Label Label1 
  72.          Alignment       =   1  'Right Justify
  73.          Caption         =   "&X:"
  74.          Height          =   252
  75.          Left            =   120
  76.          TabIndex        =   6
  77.          Top             =   360
  78.          Width           =   252
  79.       End
  80.    End
  81.    Begin VB.TextBox Index 
  82.       Height          =   288
  83.       Left            =   1680
  84.       TabIndex        =   5
  85.       Top             =   840
  86.       Width           =   732
  87.    End
  88.    Begin VB.CommandButton Cancel 
  89.       Cancel          =   -1  'True
  90.       Caption         =   "Cancel"
  91.       Height          =   372
  92.       Left            =   3120
  93.       TabIndex        =   3
  94.       Top             =   360
  95.       Width           =   972
  96.    End
  97.    Begin VB.OptionButton Append 
  98.       Caption         =   "&Append"
  99.       Height          =   252
  100.       Left            =   480
  101.       TabIndex        =   2
  102.       Top             =   1320
  103.       Width           =   1452
  104.    End
  105.    Begin VB.OptionButton Overwrite 
  106.       Caption         =   "&Overwrite"
  107.       Height          =   252
  108.       Left            =   480
  109.       TabIndex        =   1
  110.       Top             =   960
  111.       Width           =   1452
  112.    End
  113.    Begin VB.OptionButton Insert 
  114.       Caption         =   "&Insert"
  115.       Height          =   252
  116.       Left            =   480
  117.       TabIndex        =   0
  118.       Top             =   600
  119.       Width           =   972
  120.    End
  121.    Begin VB.Frame Frame1 
  122.       Caption         =   "Method of Insetion"
  123.       Height          =   1572
  124.       Left            =   240
  125.       TabIndex        =   11
  126.       Top             =   240
  127.       Width           =   2652
  128.       Begin VB.Label IndexLabel 
  129.          Alignment       =   2  'Center
  130.          Caption         =   "at i&ndex"
  131.          Height          =   252
  132.          Left            =   1320
  133.          TabIndex        =   4
  134.          Top             =   360
  135.          Width           =   732
  136.       End
  137.    End
  138.    Begin VB.Label Label5 
  139.       Caption         =   "Be careful when entering numbers. If entered string holds invalid characters, the program might crash!"
  140.       Height          =   492
  141.       Left            =   240
  142.       TabIndex        =   15
  143.       Top             =   2880
  144.       Width           =   3852
  145.    End
  146. Attribute VB_Name = "NewMV"
  147. Attribute VB_Creatable = False
  148. Attribute VB_Exposed = False
  149. Private X As Single
  150. Private Y As Single
  151. Private Function CalcHole() As Integer
  152.     X = CSng(XC)
  153.     If X < -1 Or X > 1 Then
  154.         MsgBox ("X must lie within [-1 ...1]!")
  155.         Hole = "Error"
  156.         CalcHole = 0
  157.     Else
  158.         Y = CSng(YC)
  159.         If Y < -1 Or Y > 1 Then
  160.             MsgBox ("The number must lie within [-1 ...1]!")
  161.             Hole = "Error"
  162.             CalcHole = 0
  163.         Else
  164.             r = Sqr(X * X + Y * Y)
  165.             If r > 0.7 Then
  166.                 Hole = "No (0)"
  167.             Else
  168.                 Hole = "Yes (1)"
  169.             End If
  170.             CalcHole = 1
  171.         End If
  172.     End If
  173. End Function
  174. Private Sub Append_Click()
  175.     index.Enabled = False
  176.     indexLabel.Enabled = False
  177. End Sub
  178. Private Sub Cancel_Click()
  179.     MainForm.Ret = 0
  180.     Hide
  181. End Sub
  182. Private Sub Insert_Click()
  183.     index.Enabled = True
  184.     indexLabel.Enabled = True
  185. End Sub
  186. Private Sub OKBtn_Click()
  187.     If CalcHole = 1 Then
  188.         'MainForm.Par2 = CLng(index)
  189.         MainForm.X = X
  190.         MainForm.Y = Y
  191.         MainForm.Ret = 1
  192.         Hide
  193.     End If
  194. End Sub
  195. Private Sub Overwrite_Click()
  196.     Insert_Click
  197. End Sub
  198. Private Sub XC_LostFocus()
  199.     CalcHole
  200. End Sub
  201. Private Sub YC_LostFocus()
  202.     CalcHole
  203. End Sub
  204.